const v8 = require('v8'),
      func = require('./common.js');
exports.main = (req,res) =>{
    const tool = require(req.bind.dir+'/module/emma.js');
    var HTML = tool.require('html');
    _GET = req.bind.__GET;
    var h = new HTML();
    h.isMobile(req,tool);
    h.load({'title':'V8 || '+Math.random()*100000});
    //req.setEncoding('utf-8');//无效相比=  h.appHead('<meta charset="utf-8">');
    h.appHead('<meta charset="utf-8">');
    var html = '';
    html += func.navlist(func.udata(req.url,'app'));
    html += v8about();
    h.appBody(html);
    res.write(h.getHtml());
    //  清除函数缓存
    func.clear(__dirname+'/common.js');
}
//  关于 V8
function v8about(){
    var html = '';
    var heap = v8.getHeapStatistics();
    for(var k in heap){
        html += `${k}:${heap[k]}<br>`;
    }
    return html;
}